package org.dtrd.modules.record.constant;

/**
 * recordType（1 血糖；2血压；3运动；4用药；5 饮食；6 体重；7腰围；8尿酮；9 胰岛素；10睡眠）
 * subType：0-无
 * 血糖记录：1-早餐前, 2-早餐后, 3-午餐前, 4-午餐后, 5-晚餐前, 6-晚餐后, 7-睡前, 8-凌晨
 * 饮食记录：1-早餐, 2-午餐, 3-晚餐, 4-早餐加餐, 5-午餐加餐, 6-晚餐加餐
 * 用药记录：1-早, 2-午, 3-晚, 4-睡前
 * 胰岛素：1-早, 2-午, 3-晚, 4-睡前
 * 血压：1-早, 2-晚
 */
public enum SigninType {
    /**
     * 空腹血糖
     */
    BLOOD_SUGAR_BEFORE_BREAKFAST(1, 1),
    BLOOD_SUGAR_AFTER_BREAKFAST(1, 2),
    BLOOD_SUGAR_BEFORE_LUNCH(1,3),
    BLOOD_SUGAR_AFTER_LUNCH(1,4),
    BLOOD_SUGAR_BEFORE_DINNER(1,5),
    BLOOD_SUGAR_AFTER_DINNER(1,6),
    BLOOD_SUGAR_BEFORE_SLEEP(1,7),
    BLOOD_SUGAR_EARLY_MORNING(1,8),
    BLOOD_PRESSURE_MORNING(2,1),
    BLOOD_PRESSURE_EVENING(2,2),
    SPORT(3,0),
    MEDICAL_MORNING(4,1),
    MEDICAL_NOON(4,2),
    MEDICAL_EVENING(4,3),
    MEDICAL_BEFORE_SLEEP(4,4),
    DIET_BREAKFAST(5,1),
    DIET_LUNCH(5,2),
    DIET_DINNER(5,3),
    DIET_EXTRA_BREAKFAST(5,4),
    DIET_EXTRA_LUNCH(5,5),
    DIET_EXTRA_DINNER(5,6),
    WEIGHT(6,0),
    WAISTLINE(7,0),
    KETONE(8,0),
    INSULIN_MORNING(9,1),
    INSULIN_NOON(9,2),
    INSULIN_EVENING(9,3),
    INSULIN_BEFORE_SLEEP(9,4),
    SLEEP(10,0),
    NUTRIENT_MORNING(11,1),
    NUTRIENT_NOON(11,2),
    NUTRIENT_EVENING(11,3),
    NUTRIENT_BEFORE_SLEEP(11,4);

    private int recordType;

    private int subType;

    SigninType(int recordType, int subType) {
        this.recordType = recordType;
        this.subType = subType;
    }

    public static SigninType getType(Integer recordType, Integer subType) {
        for (SigninType value : values()) {
            if (recordType.equals(value.getRecordType())
                    && subType.equals(value.getSubType())){
                return value;
            }
        }
        return null;
    }

    public int getRecordType() {
        return recordType;
    }

    public void setRecordType(int recordType) {
        this.recordType = recordType;
    }

    public int getSubType() {
        return subType;
    }

    public void setSubType(int subType) {
        this.subType = subType;
    }
}
